home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Technical Documentation / C.S.M.P. Digests / csmp-digest-v3-042 / doubleCR.1 < prev   
Encoding:
Text File  |  1994-07-07  |  64.9 KB  |  1,837 lines

  1. C.S.M.P. Digest             Tue, 05 Jul 94       Volume 3 : Issue 42
  2.  
  3. Today's Topics:
  4.  
  5.         **Novice Question on saving files**
  6.         CODE Resources
  7.         Code Resources with CodeWarrior
  8.         MacTCP DNR for PowerPC?
  9.         Major bug with Symantec CDK *Please Read*
  10.         Perspective in GX (was Re: can toolbox draw text at an angle?)
  11.         Still trouble finding floating windows code.
  12.         _vSyncWait infinite loop?
  13.         can toolbox draw text at an angle?
  14.  
  15.  
  16.  
  17. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  18. (pottier@clipper.ens.fr).
  19.  
  20. The digest is a collection of article threads from the internet newsgroup
  21. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  22. regularly and want an archive of the discussions.  If you don't know what a
  23. newsgroup is, you probably don't have access to it.  Ask your systems
  24. administrator(s) for details.  If you don't have access to news, you may
  25. still be able to post messages to the group by using a mail server like
  26. anon.penet.fi (mail help@anon.penet.fi for more information).
  27.  
  28. Each issue of the digest contains one or more sets of articles (called
  29. threads), with each set corresponding to a 'discussion' of a particular
  30. subject.  The articles are not edited; all articles included in this digest
  31. are in their original posted form (as received by our news server at
  32. nef.ens.fr).  Article threads are not added to the digest until the last
  33. article added to the thread is at least two weeks old (this is to ensure that
  34. the thread is dead before adding it to the digest).  Article threads that
  35. consist of only one message are generally not included in the digest.
  36.  
  37. The digest is officially distributed by two means, by email and ftp.
  38.  
  39. If you want to receive the digest by mail, send email to listserv@ens.fr
  40. with no subject and one of the following commands as body:
  41.     help                        Sends you a summary of commands
  42.     subscribe csmp-digest Your Name    Adds you to the mailing list
  43.     signoff csmp-digest            Removes you from the list
  44. Once you have subscribed, you will automatically receive each new
  45. issue as it is created.
  46.  
  47. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  48. Questions related to the ftp site should be directed to
  49. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  50. digest are available there.
  51.  
  52. Also, the digests are available to WAIS users.  To search back issues
  53. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  54. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  55.  
  56.  
  57. -------------------------------------------------------
  58.  
  59. >From ftrogers@eos.ncsu.edu (FRANKLIN TAREK ROGERS)
  60. Subject: **Novice Question on saving files**
  61. Date: 21 Jun 1994 13:21:32 GMT
  62. Organization: North Carolina State University, Project Eos
  63.  
  64.  
  65.  
  66.  
  67. I'm trying to save data into a file, and am having trouble understanding
  68. the underlying concepts.  Inside Macintosh "Files"  gives a verty detailed
  69. discussion on the subject, but all example deal only with TextEdit.
  70.   The FSWrite command takes a pointer to a data buffer:
  71.     What is a data buffer?  Just any allocated block of memory?
  72.  
  73. The data I wish to save is all contained within one data structure,
  74. (memory allocated with NewPointer).  Basically what I've got is:
  75.     typedef struct myStruct
  76.     {
  77.         StringPtr aString1, aString2...
  78.     }
  79.  
  80. Is a data struct of strings considered a data buffer my the OS or do I need
  81. to cram my info into some particular form.  Also, how would I find the
  82. size of the data buffer when not TextEdit?
  83.  
  84. Thanks,
  85. F. Tarek Rogers
  86. ftrogers@eos.ncsu.edu
  87.  
  88. +++++++++++++++++++++++++++
  89.  
  90. >From Rick_Holzgrafe@taligent.com (Rick Holzgrafe)
  91. Date: Tue, 21 Jun 1994 18:38:58 GMT
  92. Organization: Semicolon Software
  93.  
  94. In article <2u6pgs$k9c@taco.cc.ncsu.edu>, ftrogers@eos.ncsu.edu (FRANKLIN
  95. TAREK ROGERS) wrote:
  96.  
  97. > I'm trying to save data into a file, and am having trouble understanding
  98. > the underlying concepts.  Inside Macintosh "Files"  gives a verty detailed
  99. > discussion on the subject, but all example deal only with TextEdit.
  100. >   The FSWrite command takes a pointer to a data buffer:
  101. >     What is a data buffer?  Just any allocated block of memory?
  102.  
  103. Right. The pointer can in fact point to any memory you please, even to a
  104. local variable if that's what you want to write out.
  105.  
  106. > The data I wish to save is all contained within one data structure,
  107. > (memory allocated with NewPointer).  Basically what I've got is:
  108. >     typedef struct myStruct
  109. >     {
  110. >         StringPtr aString1, aString2...
  111. >     }
  112.  
  113. You could write out the entire struct by passing a pointer to it to
  114. FSWrite, getting its size from 'sizeof myStruct'. However, that's not what
  115. you want to do, because your structure contains only the pointers to the
  116. strings, and not the strings' contents. To write out the strings, call
  117. FSWrite once for each string, like this:
  118.  
  119.    long dataLength = (((long)myStruct.aString1[0]) & 0xff) + 1;
  120.    FSWrite (refNum, &dataLength, (ptr)myStruct.aString1);
  121.  
  122. The example assumes that your strings are in Pascal format, so that the
  123. first byte of the string gives the string's length. The part about '&0xff'
  124. ensures that you don't get a negative length for strings that have the high
  125. bit set in their length byte; it isn't always necessary but better safe
  126. than sorry.
  127.  
  128. The example also writes each string out with its proper length: no disk
  129. space is wasted. This means that when you read the strings back in, you'll
  130. have to read the length byte first to see how long the string actually is.
  131. An alternative is to always write out 256 bytes for each string (or perhaps
  132. some shorter length guaranteed to be long enough for your purposes). This
  133. wastes some space but ensures a simpler and easier-to-read file format.
  134. Normally I wouldn't recommend wantonly wasting space but if it's just a few
  135. strings the wastage may not be significant.
  136.  
  137. > how would I find the
  138. > size of the data buffer when not TextEdit?
  139.  
  140. That entirely depends on the nature and source of the data. The solution
  141. for Pascal strings is shown above.
  142.  
  143. > F. Tarek Rogers
  144. > ftrogers@eos.ncsu.edu
  145.  
  146. -- Rick Holzgrafe, a member of the Taligentsia
  147.    Rick_Holzgrafe@taligent.com
  148.    rmh@taligent.com
  149.  
  150. ---------------------------
  151.  
  152. >From Bill McCloskey <billm@interaccess.com>
  153. Subject: CODE Resources
  154. Date: 19 Jun 1994 01:14:55 GMT
  155. Organization: ???
  156.  
  157. If I was going to write a 'CODE' resource in Think C, how could I execute
  158. it in my program? Also, are there any examples for this anywhere?
  159.  
  160. Thanks for any help,
  161. -Bill
  162.  
  163. +++++++++++++++++++++++++++
  164.  
  165. >From Mark Hanrek <hanrek@cts.com>
  166. Date: Sun, 19 Jun 1994 05:08:25 GMT
  167. Organization: The Information Workshop
  168.  
  169. In article <2u066f$avl@mailhost.interaccess.com> Bill McCloskey,
  170. billm@interaccess.com writes:
  171.  
  172. > If I was going to write a 'CODE' resource in Think C, how could I
  173. > execute it in my program? Also, are there any examples for this
  174. > anywhere?
  175.  
  176. You would certainly want to copy the way it is done in some example
  177. source code.  I prepared an ansewr to a question like yours before, so
  178. I've attached it below.  It is ready to be pasted in and compiled.
  179.  
  180. Also, in your questions, you could have meant >> 'CODE' << literally or
  181. figuratively.  Just in case, I wanted to mention that resources of type
  182. 'CODE' should remain reserved for the traditional way applications are
  183. constructed, so I figure you are asking how you wuld create a custom code
  184. resource with a resource type of, say, 'CoDe', or XCMD, or 'bill' or
  185. whatever. :)
  186.  
  187. There are examples around. Be sure to look in the source code folder
  188. under "dev" in sumex and elsewhere.
  189.  
  190. Hope this helps.
  191.  
  192. Mark Hanrek
  193.  
  194.  
  195. ===================================================================
  196. Calling a Code Resource from an Application
  197.  
  198.  
  199. //
  200. //  First, determine and define the interface you would like. 
  201. //  For instance...
  202. //
  203.  
  204. typedef pascal OSErr (*CodeResourceProcPtr)( long param1, short param2 );
  205.  
  206.  
  207. //
  208. //  Here's a function in your application that will load and call that
  209. //  kind of code resource, which you've compiled separately.
  210. //
  211.  
  212.  
  213. OSErr CallCodeResource( long param1, short param2 )
  214. {
  215.   Handle               theCodeResource;
  216.   CodeResourceProcPtr  theEntryPoint;
  217.   OSErr                err;
  218.  
  219.   // Get it
  220.  
  221.   theCodeResource = GetResource( 'bill', 128 );
  222.   if ( err = ResError())
  223.      return( err );
  224.  
  225.   // Position it
  226.  
  227.   DetachResource( theCodeResource );
  228.   MoveHHi( theCodeResource );
  229.   HLock( theCodeResource );
  230.    
  231.   // Locate it and Strip it
  232.  
  233.   theEntryPoint = (CodeResourceProcPtr) StripAddress( *theCodeResource );
  234.  
  235.   // Jump into it
  236.  
  237.   err = (*theEntryPoint)( param1, param2 ); 
  238.  
  239.   // Dispose of it
  240.  
  241.   HUnlock( theCodeResource );
  242.   DisposeHandle( theCodeResource );
  243.  
  244.   return( err );
  245. }
  246.  
  247.  
  248.  
  249. - ----------------------------------------------------------
  250. The Code Resource Itself
  251.  
  252.  
  253. // Your code resource, compiled separately, would start
  254. // life like this...
  255.  
  256.  
  257. #include <SetUpA4.h>
  258.  
  259. pascal OSErr main( long param1, short param2 );
  260.  
  261. pascal OSErr main( long param1, short param2 )
  262. {
  263.     RememberA0();
  264.     SetUpA4();
  265.  
  266.  
  267.     // bla bla bla
  268.  
  269.  
  270.     RestoreA4();
  271.     return( err );
  272. }
  273.  
  274.  
  275.  
  276. - ----------------------------------------------------------
  277. Setup for Separately Compiled Code Resources
  278.  
  279.  
  280. In the "Set Project Type..." dialog, type "bill" into 
  281. the code resource type, do NOT check custom header,
  282. make sure "purgeable" is checked, and give it any name
  283. or id you like.
  284.  
  285. The ID can be important.  If you check "multi-segment" code
  286. resource, you have to be sure your code resource's id
  287. is less that 64, and it does the numbering so that the
  288. resource manager can determine at runtime which segments
  289. belong to this code resource.  There is no other "contect"
  290. to worry about or set up to worry about.
  291.  
  292. There are other resource numbering rules, but it I think
  293. the important thing is to not every use 'CODE'.
  294.  
  295.  
  296. - ----------------------------------------------------------
  297. Other Notes
  298.  
  299.  
  300. Think C provides a nice way of dealing with the interface 
  301. to code resources.  All you'll have to do to the above is
  302. change 'bill' to whatever you want, change the data type
  303. and number of parameters you'll be needing, and the data
  304. type of the return value, ( or void ).  That's it!
  305.  
  306. Intead of using DetachResource / DisposeHandle, you could 
  307. also just ReleaseResource it when you are done with it,
  308. which will save on disk thrashing if you will be accessing
  309. it a number of times.
  310.  
  311. And don't forget the keyword 'pascal' in the typedef!  You
  312. could look at your code all day long and not catch that one!
  313.  
  314. :) :)   Have fun.  
  315.  
  316.  
  317. Mark Hanrek
  318. The Information Workshop
  319.  
  320. +++++++++++++++++++++++++++
  321.  
  322. >From oster@netcom.com (David Phillip Oster)
  323. Date: Mon, 20 Jun 1994 15:52:59 GMT
  324. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  325.  
  326.  
  327. Mark Hanrek <hanrek@cts.com> posted a code example of calling a code resource.
  328. It contained some errors:
  329. 1.) it called DetachResource at the beginning and DisposHandle at the end.
  330. It is often better to omit these two steps, and just do a HGetState() at
  331. the beginning and an HSetState() at the end.
  332.  
  333. 2.) It assumes that both the calling C program and the code resource are
  334. either both 680x0 code or both PowerPC code. If there is a chance that they
  335. might be mixed, you need to call the code resource slightly differently.
  336. This is fully documented in the PowerPC volume of InsideMac. You also might
  337. want to consider creating a "fat" code resource, chich contains both 680x0
  338. and PowerPC instructions so it it will run at top speed no matter who calls
  339.  
  340. +++++++++++++++++++++++++++
  341.  
  342. >From Kevin.R.Boyce@gsfc.nasa.gov (Kevin R. Boyce)
  343. Date: Mon, 20 Jun 1994 12:38:47 -0400
  344. Organization: NASA/GSFC
  345.  
  346. Mark Hanrek <hanrek@cts.com> wrote:
  347.  
  348. > In article <2u066f$avl@mailhost.interaccess.com> Bill McCloskey,
  349. > billm@interaccess.com writes:
  350. > > If I was going to write a 'CODE' resource in Think C, how could I
  351. > > execute it in my program? Also, are there any examples for this
  352. > > anywhere?
  353. > You would certainly want to copy the way it is done in some example
  354. > source code.  I prepared an ansewr to a question like yours before, so
  355. > I've attached it below.  It is ready to be pasted in and compiled.
  356.  
  357. [Sample code that is almost identical to my own stock answer deleted.]
  358.  
  359. There is one other thing you need to be aware of, if you are using any
  360. system callbacks in your code resource.  (System callbacks are things like
  361. dialog filters, that get called from within an OS/Toolbox routine that you
  362. call.)  The problem is that the system may have messed with A4 before
  363. calling your callback routine, so you have to set it up within the
  364. callback.  
  365.  
  366. Here is the second half of my stock answer, where I discuss this in detail:
  367.  
  368. And one final (very important) point is that the A4 routines are static
  369. (they only apply to the file in which they appear).  So if you need to
  370. use SetUpA4() in a file other than the one which called RememberA0(),
  371. you need to call RememberA4() (NOT RememberA0()) from within that file,
  372. sometime before the call to SetUpA4().  Uh, maybe an example would
  373. help (this also demonstrates how to return the value of a global)...
  374.  
  375. - - file MainCode.c ---
  376. #include <SetUpA4.h>
  377. char    aGlobal;
  378.  
  379. char main(long foo)        /* Wants to return value of aGlobal */
  380. {
  381.     char    retVal;
  382.     
  383.     RememberA0();
  384.     SetUpA4();
  385.     ...
  386.     DoSomeDialog();
  387.     ...
  388.     retVal = aGlobal;    /* Have to do this while A4 is still valid! */
  389.     RestoreA4();        /* A4 no longer points to our global area */
  390.     return retVal;        /* But local (automatic) variables are still ok */
  391. }
  392.  
  393.  
  394. - - file MyDialogs.c ---
  395.  
  396. #include <SetUpA4.h>
  397. extern short    aGlobal;
  398.  
  399. void DoSomeDialog()
  400. {
  401.     DialogPtr    theDialog;
  402.     short        itemHit;
  403.     
  404.     RememberA4();        /* Save A4 for functions in this file. */
  405.     theDialog = GetNewDialog( dlgRsrcID, nil, (WindowPtr)-1 );
  406.     ModalDialog( myFilter, &itemHit );
  407.     ...
  408.     return;
  409. }
  410.  
  411. pascal Boolean MyFilter(DialogPtr theDlg, EventRecord *theEvent, short
  412. *itemHit )
  413. {
  414.     Boolean    status;
  415.     
  416.     SetUpA4();
  417.     
  418.     if ( theEvent->what == keyDown ) {
  419.         aGlobal = (theEvent->message) & charCodeMask;
  420.         *itemHit = ok;
  421.         status = TRUE;
  422.     } else {
  423.         status = FALSE;
  424.     }
  425.     RestoreA4();
  426.     return status;
  427. }
  428.  
  429.  
  430. -- 
  431. Kevin      Kevin.R.Boyce@gsfc.nasa.gov
  432. I then suspended the assembly by the edges of the CD, and began filling
  433. the box with Inside Macintosh volumes. --Kevin Bell
  434.  
  435. +++++++++++++++++++++++++++
  436.  
  437. >From Mark Hanrek <hanrek@cts.com>
  438. Date: Tue, 21 Jun 1994 08:45:55 GMT
  439. Organization: The Information Workshop
  440.  
  441. In article <osterCrpDGC.7K4@netcom.com> David Phillip Oster,
  442. oster@netcom.com writes:
  443.  
  444. >It contained some errors:
  445. >1.) it called DetachResource at the beginning and DisposHandle at the
  446. end.
  447. >It is often better to omit these two steps, and just do a HGetState() at
  448. >the beginning and an HSetState() at the end.
  449. >
  450. >2.) It assumes that both the calling C program and the code resource are
  451. >either both 680x0 code or both PowerPC code. If there is a chance that
  452. they
  453. >might be mixed, you need to call the code resource slightly differently.
  454. >This is fully documented in the PowerPC volume of InsideMac. You also
  455. might
  456. >want to consider creating a "fat" code resource, chich contains both
  457. 680x0
  458. >and PowerPC instructions so it it will run at top speed no matter who
  459. calls
  460.  
  461. David,
  462.  
  463. Neither are errors.  Errors are where you do something wrong.
  464.  
  465. The first is a situational kind of thing.
  466.  
  467. As for the PowerPC concerns, that is not appropriate here, because the
  468. Bill asked how to call a code resource, and he was given just what he
  469. needs to be successful.
  470.  
  471. The objective in answering questions is to hopefully make it so the
  472. answer makes whatever it is seem like a piece of cake.
  473.  
  474. My DetachResource approach isolates him from Resource Manager concerns so
  475. this does not foul up his first experiences.  Moving the handle high also
  476. eliminates memory fragmentation concerns. By and by, he will know as much
  477. about it as you or I and be answering questions himself. :)
  478.  
  479. Not only that, if he wanted to take advantage of what you mentioned, how
  480. would he do that?  All you did was mention that there was a concern, and
  481. a reference to HGetState.
  482.  
  483. Kevin on the other hand, rather than simply mentioning that there are
  484. concerns with dialog callbacks, laid it all out in black and white, and
  485. very clearly.  A piece of cake. :)
  486.  
  487.  
  488. Mark Hanrek
  489.  
  490. P.S. There were, though, tons of editing errors in my post. Something
  491. must have gone wrong with the editor.  ( yeah, right :)
  492.  
  493. ---------------------------
  494.  
  495. >From will@cs.su.oz.au (William Uther)
  496. Subject: Code Resources with CodeWarrior
  497. Date: 20 Jun 1994 16:16:24 +1000
  498. Organization: Basser Dept of Computer Sciece, Uni of Sydney, Australia
  499.  
  500. Hi,
  501.   I've just been trying to covert a THINK C 6.0 Code Resource to CodeWarrior.
  502. I'm using the 68k DR3.  I've set the prefs up to produce a code resource and
  503. included all the files.
  504.   When I test the code resource it doesn't work.  The A4 world is set up by the
  505. program calling the code resource.  And seems to be correct.  One of the first
  506. things the code resource does is call TextBox to display a debug string.
  507. The call is in the assembler - but it doesn't come up.  I have no idea
  508. wot's wrong.  There are NO compile or link errors.
  509.  
  510. Are there any bugs in DR3 with code resources, or is there some strange thing I
  511. have to set - I've RTFM'd but there really isn't much there.
  512.  
  513. \x/ill            :-}
  514.  
  515.  
  516. +++++++++++++++++++++++++++
  517.  
  518. >From rang@winternet.com (Anton Rang)
  519. Date: 20 Jun 1994 12:27:49 GMT
  520. Organization: Minnesota Angsters
  521.  
  522. In article <2u3c7o$6sh@staff.cs.su.oz.au> will@cs.su.oz.au (William Uther) writes:
  523. >When I test the code resource it doesn't work.  The A4 world is set
  524. >up by the program calling the code resource.  And seems to be
  525. >correct.
  526.  
  527.   You say the A4 world is set up by the *caller*?  Are you following
  528. the CodeWarrior rules on this?  (They're different from THINK.)  In
  529. THINK C, the A4 register needs to point to the beginning of the code
  530. resource.  I don't recall the CW rules for sure, but it's definitely
  531. different, more along the lines of 'A4 = the end plus $8000'.  (Run
  532. one of the examples that uses A4, or write a quick one, and pop into
  533. the debugger to check for sure.)
  534. --
  535. Anton Rang (rang@winternet.com)
  536.  
  537. +++++++++++++++++++++++++++
  538.  
  539. >From will@cs.su.oz.au (William Uther)
  540. Date: 20 Jun 1994 22:43:21 +1000
  541. Organization: Basser Dept of Computer Sciece, Uni of Sydney, Australia
  542.  
  543. Hello again,
  544.   Fixed the problem - I was assuming that CW used a similar A4 world to THINK
  545. and MPW - A4 was being set wrong and yet it wasn't crashing.  It would be nice
  546. if this were mentioned in the manuals (I eventaully found it, well documented,
  547. in a code example).
  548.  
  549. \x/ill       :-}
  550.  
  551. P.S.  Aside from the odd conversion problem from THINK C, CW is very good - I
  552. am in the process of converting everything.
  553.  
  554.  
  555. ---------------------------
  556.  
  557. >From Frank Price <wprice@netcom.com>
  558. Subject: MacTCP DNR for PowerPC?
  559. Date: Tue, 21 Jun 1994 03:16:28 GMT
  560. Organization: Netcom
  561.  
  562. I noticed that the DNR.c file on the CodeWarrior DR3 CD and the MacOnRISC
  563. release CD is basically bogus when it actually gets compiled.  It is far
  564. from a complete conversion to native code...at least as far as
  565. CodeWarrior is concerned.  After making many small changes that were
  566. obvious, the functions still "don't match prototypes."  Anyway, I'd
  567. rather not muck with this file if there is an official or correctly
  568. updated version out there.  Anyone know what the story is or want to send
  569. me an updated file?
  570.  
  571. Thanks!
  572. Frank
  573.  
  574. +++++++++++++++++++++++++++
  575.  
  576. >From scouten@maroon.tc.umn.edu (Eric Scouten)
  577. Date: Tue, 21 Jun 1994 14:29:56 GMT
  578. Organization: University of Minnesota, Student Affairs
  579.  
  580. In article <netnewsCrq93H.JBq@netcom.com>, Frank Price <wprice@netcom.com>
  581. wrote:
  582.  
  583. > I noticed that the DNR.c file on the CodeWarrior DR3 CD and the MacOnRISC
  584. > release CD is basically bogus when it actually gets compiled.  It is far
  585. > from a complete conversion to native code...at least as far as
  586. > CodeWarrior is concerned.  After making many small changes that were
  587. > obvious, the functions still "don't match prototypes."  Anyway, I'd
  588. > rather not muck with this file if there is an official or correctly
  589. > updated version out there.  Anyone know what the story is or want to send
  590. > me an updated file?
  591.  
  592. Sorry. You'll have to rewrite DNR.c.
  593.  
  594. Apple did a pretty poor job of creating a universal header for this file.
  595. You will have to change all of the typedefs and the ProcInfo definitions.
  596. The following is an excerpt from some of my own TCP code that shows the
  597. corrected values.
  598.  
  599. - -------
  600.  
  601. // NOTE: The dnr.c file created for universal headers contained an error.
  602. All
  603. // of the selectors are treated by the DNR as long values, not short. This
  604. has
  605. // been corrected in TurboTCP.
  606.  
  607. extern "C" {
  608.  
  609. typedef OSErr (*OpenResolverProcPtr)(long selector, char* fileName);
  610.                    //                ^^^^ this was "short" in dnr.c
  611. typedef OSErr (*CloseResolverProcPtr)(long selector);
  612. typedef OSErr (*StrToAddrProcPtr)(long selector, char* hostName,
  613.         struct hostInfo* rtnStruct, long resultProc, char* userData);
  614. typedef OSErr (*AddrToStrProcPtr)(long selector, long address, char*
  615. hostName);
  616. typedef OSErr (*AddrToNameProcPtr)(long selector, unsigned long addr,
  617.         struct hostInfo* rtnStruct, long resultProc, char* userData);
  618. typedef OSErr (*HInfoProcPtr)(long selector, char* hostName,
  619.         struct returnRec* returnRecPtr, long resultProc, char* userData);
  620. typedef OSErr (*MXInfoProcPtr)(long selector, char* hostName,
  621.         struct returnRec* returnRecPtr, long resultProc, char* userData);
  622.  
  623. };
  624.  
  625. #if USESROUTINEDESCRIPTORS
  626.  
  627. enum {
  628.     uppOpenResolverProcInfo = kCStackBased
  629.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  630.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  631.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
  632. };
  633.  
  634. // etc.
  635.  
  636. //
  637. // change parameter 1 of all ProcInfos to (sizeof(long))
  638. //
  639.  
  640. - -------
  641.  
  642. Hope this was helpful.
  643.  
  644. -Eric
  645.  
  646.  
  647. -- 
  648. Eric Scouten  *  U of MN  *  scouten@maroon.tc.umn.edu  *  +1 612 626 0746
  649.   ** MS Computer Science student, Univ of Illinois, starting Aug '94 **
  650.  
  651. Maps tell the truth, the whole truth, and anything but the truth.
  652.  
  653. ---------------------------
  654.  
  655. >From kerr@math.ohio-state.edu (Kerr Gibson)
  656. Subject: Major bug with Symantec CDK *Please Read*
  657. Date: 21 Jun 1994 19:13:36 -0400
  658. Organization: Department of Mathematics, The Ohio State University
  659.  
  660.  
  661. Thought I would write this to spare you some of the headaches I went
  662. through in linking a Symantec PPC project.
  663.  
  664.  
  665. My original problem was that I had ported an old project to a new Virtual
  666. Architect PPC project.  The project linked via the ToolServer and produced
  667. an application which inexplicably would not run.  All it would do was produce
  668. an error and quit.
  669.  
  670. The actual bug has to do with Quicktime and the makefile for the ToolServer. 
  671. My original project uses Quicktime and the QuickTime xcoff library is not
  672. included in the VA PPC starter project. "Uh Oh.", I think, "I had better make
  673. sure the Quicktime lib is included in the linker script for the ToolServer.  
  674. So I open the PPCBuild.ts file and find the following:
  675.  
  676. ...
  677. MakePEF {XCOFFname} -o {AppName} 6
  678.    -l "AppleScriptLib.xcoff.o=AppleScriptLib" 6
  679.    -l "InterfaceLib.xcoff.o=InterfaceLib" 6
  680.    -l "MathLib.xcoff.o=MathLib" 6
  681.    -l "ObjectSupportLib.xcoff.o=ObjectSupportLib" 6
  682.    -l "QuickTimeLib.xcoff.o=InterfaceLib" 6
  683.    -l "StdCLib.xcoff.o=StdCLib" 6
  684.    -ft 'APPL' -fc "{Creator}"
  685.  
  686. Lo and behold, it is already there. "Ok Cool", I say to myself, "I just won't
  687. change the file." So I leave it alone and then I spend the next week trying to
  688. figure out why my program links but wont run.  The astute observer of course
  689. will see what I failed to notice:
  690.  
  691. -l "QuickTimeLib.xcoff.o=InterfaceLib" 6
  692.                          ^^^^^^^^^^^^
  693.       Its the wrong d*mn library name!
  694.  
  695. This explains the issue. The linker did not report an error because the library
  696. really was loaded.  Unfortunately it was loaded right over top of the previous
  697. InterfaceLib PEF file!  The reason this bug was never found is because if there
  698. is no Quicktime lib in the project, it is ignored by this script.  I imagine
  699. that this little diddy wreaked hell with the code fragment, hence, it was 
  700. unable to run.
  701. I had been duped by a simple copy/paste error (see 3 lines above it).  Now 
  702. I don't have a problem with copy/paste errors, God knows I make them all the 
  703. time.  But I'm a little miffed that certain libraries were never tested with 
  704. the final out-the-door product.
  705.  
  706. Anyway, if you want to use QuickTime with the CDK, this is your warning.
  707.  
  708. --Kerr Gibson
  709.  
  710. P.S. I'm also pissed that the Finder did not give me an error code- all
  711. it said was "The Application xxx could not be launched because an error
  712. ocurred."  What gives?
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721. ---------------------------
  722.  
  723. >From ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  724. Subject: Perspective in GX (was Re: can toolbox draw text at an angle?)
  725. Date: 21 Jun 94 14:06:37 +1200
  726. Organization: University of Waikato, Hamilton, New Zealand
  727.  
  728. In article <3624861694.8241498@tempest.tempest.net.hk>, johnb@tempest.net.hk (John W. Blackburne) writes:
  729. > Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  730. >
  731. >> Why yes -- QuickDraw GX supports arbitrary transformations of text,
  732. > including
  733. >> skew and perspective in addition to rotation. Anything you can describe in
  734. > a
  735. >> 3x3 matrix. Not only that, but you can allow the user to edit the
  736. > transformed
  737. >> text (typing into perspective text is pretty trippy.) You can also fit text
  738. >> to a curve, but it's not directly editable after that.
  739. >
  740. > Can someone please explain to me how this works. If you are using a 3 x 3
  741. > matrix (on an anything x anything matrix) for transformations you get
  742. > linear transformations, which include scaling, rotating, reflecting and
  743. > skewing but NOT transforming the perspective of a shape, at least not when
  744. > operating on the real two-dimensional space QD GX works in.
  745.  
  746. Yes, you can. Remember, these are 3 x 3 matrices, not 2 x 2. Also,
  747. perspective is very much a linear transformation, since it maps straight lines
  748. to straight lines, after all.
  749.  
  750. Here's how it works: for transformations other than perspective, you work
  751. in homogeneous coordinates, which normally look like this:
  752.  
  753.     [x y 1] [a b 0] = [x' y' 1]
  754.         [c d 0]
  755.         [e f 1]
  756.  
  757. Perspective transforms work like this:
  758.  
  759.     [x y 1] [1 0 u] = [x y (xu + yv + 1)]
  760.         [0 1 v]
  761.         [0 0 1]
  762.  
  763. The matrix doesn't quite fit into the usual normalized form, but QuickDraw GX
  764. supports it just fine. And when you normalize the result vector, you end up with
  765.  
  766.     x' = x / (xu + yv + 1)
  767.     y' = y / (xu + yv + 1)
  768.  
  769. et voila! A perspective transformation. Of course, you can combine these
  770. with other linear transformations in the usual way.
  771.  
  772. Now the big mystery: with all the other convenience routines that they bothered
  773. to put into the QuickDraw GX API, why didn't they include one to build
  774. perpective transformations?
  775.  
  776. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  777. Info & Tech Services Division              fax: +64-7-838-4066
  778. University of Waikato            electric mail: ldo@waikato.ac.nz
  779. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  780. "If you want competence, you must read everything. But, if you want
  781. originality, you must not."                    -- Edward de Bono
  782.  
  783. +++++++++++++++++++++++++++
  784.  
  785. >From turk@apple.com (Ken Turkowski)
  786. Date: Tue, 21 Jun 1994 21:56:40 GMT
  787. Organization: Apple Computer, Inc.
  788.  
  789. In article <1994Jun21.140637.29986@waikato.ac.nz>, ldo@waikato.ac.nz
  790. (Lawrence D'Oliveiro, Waikato University) wrote:
  791.  
  792. > Now the big mystery: with all the other convenience routines that they bothered
  793. > to put into the QuickDraw GX API, why didn't they include one to build
  794. > perpective transformations?
  795.  
  796. Try Quad2D2Quad2D(), given below. This works if you know the projective
  797. transformations of 4 points.
  798.  
  799. Are there any other specifications you'd be interested in?
  800.  
  801. /* Original code due to Paul Heckbert.
  802.  * Recoded by Ken Turkowski.
  803.  * AS IS. No guarantees.
  804.  */
  805.  
  806.  
  807.  
  808. #define MAXDIM 32
  809.  
  810. #define kFudge            1e-16
  811. #define kBadMap            0
  812. #define kProjectiveMap    1
  813. #define kAffineMap        2
  814.  
  815. #include <math.h>
  816.  
  817. #define ConcatMap(map1Type, map2Type) ((map1Type < map2Type) ? map1Type :
  818. map2Type)
  819.  
  820. typedef struct TPoint2D        { float x, y; }            TPoint2D;
  821. typedef struct TPoint3D        { float x, y, z; }        TPoint3D;
  822. typedef struct TVector4D    { float x, y, z, w; }    TVector4D;
  823.  
  824. typedef FLOAT vec3[3];
  825.  
  826. void
  827. MLAdjointMatrix3x3(float *M)
  828. {
  829.     float t[3][3];
  830.     struct MX { float m[3][3]; };
  831.     register vec3* m = (vec3*)M;
  832.     
  833.     t[0][0] =   m[1][1] * m[2][2] - m[1][2] * m[2][1];    /* t(0,0) */
  834.     t[0][1] = - m[0][1] * m[2][2] + m[0][2] * m[2][1];    /* t(0,1) */
  835.     t[0][2] =   m[0][1] * m[1][2] - m[0][2] * m[1][1];    /* t(0,2) */
  836.     t[1][0] = - m[1][0] * m[2][2] + m[1][2] * m[2][0];    /* t(1,0) */
  837.     t[1][1] =   m[0][0] * m[2][2] - m[0][2] * m[2][0];    /* t(1,1) */
  838.     t[1][2] = - m[0][0] * m[1][2] + m[0][2] * m[1][0];    /* t(1,2) */
  839.     t[2][0] =   m[1][0] * m[2][1] - m[1][1] * m[2][0];    /* t(2,0) */
  840.     t[2][1] = - m[0][0] * m[2][1] + m[0][1] * m[2][0];    /* t(2,1) */
  841.     t[2][2] =   m[0][0] * m[1][1] - m[0][1] * m[1][0];    /* t(2,2) */
  842.     
  843.     *((struct MX*)(&m[0][0])) = *((struct MX*)(&t[0][0]));
  844. }
  845.  
  846.  
  847. /****************************************************************
  848.  * Linear transformations, for transforming vectors and matrices.
  849.  * This works for row vectors and column vectors alike.
  850.  *    L[nRows][lCol]    - input (left) matrix
  851.  *    rg[lCol][rCol]    - transformation (right) matrix
  852.  *    P[nRows][rCol]    - output (product) matrix
  853.  *
  854.  * Examples:
  855.  * v[3] * M[3][3] -> w[3] :            LinearTransform(&v[0], &M[0][0], &w[0], 1, 3,
  856. 3);
  857.  * M[3][3] * v[3] -> w[3] :            LinearTransform(&M[0][0], &v[0], &w[0], 3, 3,
  858. 1);
  859.  * M[4][4] * N[4][4] -> P[4][4]:    LinearTransform(&M[0][0], &N[0][0],
  860. &P[0][0], 4, 4, 4);
  861.  * v[4] * M[4][3] -> w[3]:            LinearTransform(&v[0], &M[0][0], &w[0], 1, 4,
  862. 3);
  863.  * v[3] tensor w[3] -> T[3][3]:        LinearTransform(&v[0], &w[0], T[3][3], 3,
  864. 1, 3);
  865.  ****************************************************************/
  866.  
  867. void
  868. LinearTransform(
  869.     const float *L,        /* The left matrix */
  870.     const float *R,        /* The right matrix */
  871.     register float *P,    /* The resultant matrix */
  872.     long nRows,            /* The number of rows of the left and resultant matrices */
  873.     long lCol,            /* The number of columns in the left matrix */
  874.     long rCol            /* The number of columns in the resultant matrix */
  875. )
  876. {
  877.     register const float *lp;        /* Left matrix pointer for dot product */
  878.     register const char *rp;        /* Right matrix pointer for dot product */
  879.     register long k;                    /* Loop counter */
  880.     register long double sum;        /* Extended precision for intermediate results
  881. */
  882.     register long rRowBytes = rCol * sizeof(float);
  883.     register long j, i;                /* Loop counters */
  884.     register long lRowBytes = lCol * sizeof(float);
  885.     const char *lb = (const char*)L;
  886.  
  887.     for (i = nRows; i--; lb += lRowBytes) {    /* Each row in L */
  888.         for (j = 0; j < rCol; j++) {    /* Each column in R */
  889.             lp = (const float *)lb;        /* Left of ith row of L */
  890.             rp = (const char *)(R + j);    /* Top of jth column of R */
  891.             sum = 0;
  892.             for (k = lCol; k--; rp += rRowBytes)
  893.                 sum += *lp++ * (*((const float*)rp));    /* *P += L[i'][k'] * R[k'][j] */
  894.             *P++ = sum;
  895.         }
  896.     }
  897. }
  898.  
  899.  
  900. /****************************************************************
  901.  ****************************************************************
  902.  ****************************************************************
  903.  ***    2D Projective Mappings
  904.  ****************************************************************
  905.  ****************************************************************
  906.  ****************************************************************/
  907.  
  908.  
  909. #define DET2(a,b, c,d) ((a)*(d) - (b)*(c))
  910.  
  911.  
  912. /****************************************************************
  913.  * UnitSquare2Quad2D()
  914.  *
  915.  * compute the TDMatrix3x3 M such that
  916.  *    [x y w] = [u v 1] M
  917.  * where the points
  918.  *    (0,0), (0,1), (1,1), (1,0)
  919.  * map into the points
  920.  *    p[0], p[1], p[2], p[3].
  921.  ****************************************************************/
  922. int
  923. UnitSquare2Quad2D(register const TPoint2D *p, float M[3][3])
  924. {
  925.     double px, py;
  926.     double dx12, dx32, dy12, dy32;
  927.     double d, g, h;
  928.  
  929.     px = p[0].x - p[1].x + p[2].x - p[3].x;
  930.     py = p[0].y - p[1].y + p[2].y - p[3].y;
  931.     
  932.     if ((fabs(px) < kFudge) && (fabs(py) < kFudge)) {    /* Affine */
  933.         M[0][0] = p[1].x-p[0].x;    M[0][1] = p[1].y-p[0].y;    M[0][2] = 0;    /* New
  934. x-axis */
  935.         M[1][0] = p[3].x-p[0].x;    M[1][1] = p[3].y-p[0].y;    M[1][2] = 0;    /*
  936. New y-axis */
  937.         M[2][0] = p[0].x;            M[2][1] = p[0].y;            M[2][2] = 1;    /* New origin
  938. */
  939.         return(kAffineMap);
  940.     }
  941.     
  942.  
  943.     /* Projective mapping */
  944.     dx12 = p[1].x - p[2].x;
  945.     dx32 = p[3].x - p[2].x;
  946.     dy12 = p[1].y - p[2].y;
  947.     dy32 = p[3].y - p[2].y;
  948.     d = DET2(dx12,dx32, dy12,dy32);    /* Discriminant */
  949.     g = DET2(px,dx32, py,dy32);        /* X-keystoning */
  950.     h = DET2(dx12,px, dy12,py);        /* Y-Keystoning */
  951.     
  952.     if (d != 0) {
  953.         g /= d;    /* Normalize these to get a matrix in standard form */
  954.         h /= d;
  955.     
  956.         M[0][0] = p[1].x-p[0].x+g*p[1].x;    M[0][1] =
  957. p[1].y-p[0].y+g*p[1].y;    M[0][2] = g;
  958.         M[1][0] = p[3].x-p[0].x+h*p[3].x;    M[1][1] =
  959. p[3].y-p[0].y+h*p[3].y;    M[1][2] = h;
  960.         M[2][0] = p[0].x;                    M[2][1] = p[0].y;                    M[2][2] = 1;
  961.     
  962.         return(kProjectiveMap);
  963.     }
  964.     else {
  965.         return(kBadMap);
  966.     }
  967.  
  968. }
  969.  
  970.  
  971. /****************************************************************
  972.  * Rect2Projective()
  973.  *
  974.  * compute the matrix M[3][3] such that
  975.  *    [x y w] = [u v 1] M
  976.  * where the points
  977.  *    q[0], q[1], q[2], q[3]
  978.  * map into the points
  979.  *    p[0], p[1], p[2], p[3].
  980.  * If the inverse flag is set, it map xy->uv instead of ux->xy
  981.  ****************************************************************/
  982. int
  983. Rect2Quad2D(double u0, double v0, double u1, double v1, const TPoint2D* p,
  984. float M[3][3], int inverse)
  985. {
  986.     double du = u1 - u0;
  987.     double dv = v1 - v0;
  988.     int mapType;
  989.  
  990.     if (du == 0 || dv == 0)
  991.         return(0);    /* Degenerate rectangle */
  992.     
  993.     if ((mapType = UnitSquare2Quad2D(p, M)) == kBadMap)
  994.         return(kBadMap);    /* Bad perspectivity */
  995.     
  996.     /* Apply rectangular stretching and translation */
  997.     M[0][0] /= du;                        M[0][1] /= du;                        M[0][2] /= du;
  998.     M[1][0] /= dv;                        M[1][1] /= dv;                        M[1][2] /= dv;
  999.     M[2][0] -= M[0][0]*u0+M[1][0]*v0;    M[2][1] -=
  1000. M[0][1]*u0+M[1][1]*v0;    M[2][2] -= M[0][2]*u0+M[1][2]*v0;
  1001.  
  1002.     if (inverse)    /* Do we want uv->xy or xy->uv? */
  1003.         AdjointMatrix3x3(M[0]);    /* xy->uv! */
  1004.     
  1005.     return(mapType);
  1006. }
  1007.  
  1008.  
  1009. /****************************************************************
  1010.  * Quad2D2Quad2D()
  1011.  *
  1012.  * compute the matrix M[3][3] such that
  1013.  *    [x y w] = [u v 1] M
  1014.  * where the points
  1015.  *    q[0], q[1], q[2], q[3]
  1016.  * map into the points
  1017.  *    p[0], p[1], p[2], p[3].
  1018.  ****************************************************************/
  1019. int
  1020. Quad2D2Quad2D(register const TPoint2D* q, const TPoint2D* p, float M[3][3])
  1021. {
  1022.     if (q[0].x==q[3].x && q[1].x==q[2].x &&    /* vertical   edges 3-0 and 1-2 */
  1023.         q[0].y==q[1].y && q[2].y==q[3].y    /* horizontal edges 0-1 and 2-3 */
  1024.     ) {
  1025.         return(Rect2Quad2D(q[0].x, q[0].y, q[2].x, q[2].y, p, M, 0));
  1026.     }
  1027.     
  1028.     else if (q[0].x==q[1].x && q[2].x==q[3].x &&
  1029.              q[1].y==q[2].y && q[3].y==q[0].y
  1030.     ) {
  1031.         TPoint2D prot[4];
  1032.         prot[0]=p[1]; prot[1]=p[2]; prot[2]=p[3]; prot[3]=p[0];    /* cycle points
  1033. */
  1034.         return(Rect2Quad2D(q[1].x, q[1].y, q[3].x, q[3].y, prot, M, 0));
  1035.     }
  1036.  
  1037.     else {
  1038.         float L[3][3], R[3][3];
  1039.         int map1Type, map2Type;
  1040.         
  1041.         /* Calculate mapping from quad q to unit square */
  1042.         if ((map1Type = UnitSquare2Quad2D(q, L)) == kBadMap)    /* unit square to
  1043. quad q */
  1044.             return(kBadMap);
  1045.         AdjointMatrix3x3(L[0]);
  1046.         
  1047.         /* Calculate mapping from unit square to quad p */
  1048.         if ((map2Type = UnitSquare2Quad2D(p, R)) == kBadMap)    /* unit square to
  1049. quad p */
  1050.             return(kBadMap);
  1051.         
  1052.         /* Concatenate the two transformations */
  1053.         LinearTransform(L[0], R[0], M[0], 3, 3, 3);
  1054.  
  1055.         return(ConcatMap(map1Type, map2Type));
  1056.     }
  1057. }
  1058.  
  1059.  
  1060. //Ken Turkowski; Apple Computer, Inc.; 1 Infinite Loop; Cupertino, CA 95014
  1061. //turk@apple.com
  1062.  
  1063. ---------------------------
  1064.  
  1065. >From gilem@litecdev.eng.rpi.edu (Michael R. Gile)
  1066. Subject: Still trouble finding floating windows code.
  1067. Date: 14 Jun 1994 18:36:13 GMT
  1068. Organization: Rensselaer Polytechnic Institute, Troy NY
  1069.  
  1070. I am still looking for some code which implements floating windows on the mac,
  1071. which will compile using either think C or metrowerks C.  I have tried 
  1072. compiling yu's code from d e v e l o p issue 15 using both of these
  1073. compilers, with absolutely no success. The code compiles, but then crashes 
  1074. hard as soon as any events are sent to the handlers.  Does anyone
  1075. have any suggestions?  I don't have MPW, so that doesn't help.
  1076.  
  1077. thanks
  1078. Mike
  1079. -- 
  1080. Michael Gile                        |               Graduate Assistant
  1081. gilem@rpi.edu                       |   Computer & Systems Engineering
  1082. "Don't Blame Me, I voted for Perot!"| Rensselaer Polytechnic Institute
  1083.  
  1084. +++++++++++++++++++++++++++
  1085.  
  1086. >From egurney@vcd.hp.com (Eddy J. Gurney)
  1087. Date: Wed, 15 Jun 1994 01:01:35 GMT
  1088. Organization: Hewlett-Packard VCD
  1089.  
  1090. Michael R. Gile (gilem@litecdev.eng.rpi.edu) wrote:
  1091. >I am still looking for some code which implements floating windows on
  1092. >the mac, which will compile using either think C or metrowerks C. I
  1093. >have tried compiling yu's code from d e v e l o p issue 15 using both
  1094. >of these compilers, with absolutely no success. The code compiles, but
  1095. >then crashes hard as soon as any events are sent to the handlers. Does
  1096. >anyone have any suggestions? I don't have MPW, so that doesn't help.
  1097.  
  1098. Well, there are some bugs in the code, even with the latest version on
  1099. the Bookmark 18 CD. But it may work for your application. (I sent mail
  1100. to Dean Yu on them and did not get a response.)
  1101.  
  1102. Your problem most likely has to do with the fact that the code is
  1103. written for MPW and *not* THINK C, which use different methods to access
  1104. low-memory globals (unless you have compiled MacHeaders to use SysEqu.h
  1105. instead of LoMem.h, not likely for the average joe.)
  1106.  
  1107. Anyway, the solution is to look at the two functions GetWindowList() and
  1108. SetWindowList() and change them to
  1109.  
  1110. return (WindowRef)WindowList;
  1111.  
  1112. and 
  1113.  
  1114. WindowList = (WindowPeek)windowReference;
  1115.  
  1116. respectively.
  1117.  
  1118. A more robust solution would be to #ifdef THINKC (or whatever the
  1119. compiler-set define is) around these changes, but I digress...
  1120.  
  1121. --
  1122. Eddy J. Gurney N8FPW   Hewlett-Packard Company, Vancouver (USA!) Division
  1123. egurney@vcd.hp.com                       #include <standard-disclaimer.h>
  1124. "Failures are divided into two classes-- those who thought and never did,
  1125.       and those who did and never thought."     John Charles Salak
  1126.  
  1127. +++++++++++++++++++++++++++
  1128.  
  1129. >From kenlong@netcom.com (Ken Long)
  1130. Date: Wed, 15 Jun 1994 05:43:20 GMT
  1131. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1132.  
  1133. There are floating window sources available on the net.  Some even have 
  1134. the word "float" or "floating" in the filename.  What I'd recommend is 
  1135. connecting to the major Mac source sites and getting all sources with 
  1136. window, WDEF and floating in the filename.  Better yet, connect and get 
  1137. any description indexes for the site, and target your files you want to 
  1138. get before you connect for the files.
  1139.  
  1140. "Nifty" has floaters, Infinity Windoid (an excellent one), an old file 
  1141. called "floating" does, too.  As I recall, buried down in the TCL folder, 
  1142. in a subfolder, that came with Think C there is a windoid source.
  1143.  
  1144. These sources may or may not have routines which result in the window 
  1145. staying in front no matter what (maybe bar dialogs), but there was a 
  1146. lengthy thread on this not to long ago.  Maybe someone saved the thread 
  1147. and would send it to you, as well.
  1148.  
  1149. -Ken-
  1150.  
  1151.  
  1152.  
  1153. +++++++++++++++++++++++++++
  1154.  
  1155. >From Mark Hanrek <hanrek@cts.com>
  1156. Date: Wed, 15 Jun 1994 08:10:29 GMT
  1157. Organization: The Information Workshop
  1158.  
  1159. In article <2tktau$asu@usenet.rpi.edu> Michael R. Gile,
  1160. gilem@litecdev.eng.rpi.edu writes:
  1161.  
  1162. > I am still looking for some code which implements floating windows on
  1163. the mac,
  1164. > which will compile using either think C or metrowerks C. 
  1165.  
  1166. Besides what was just mentioned, I know there is an example called
  1167. "Floating Windows 1.3" floating around. ( Sorry :)
  1168.  
  1169. But, the best floating windows C example source code, integrated with the
  1170. best windowing I have ever seen, is available as part of DTS.Lib, written
  1171. by Eric Soldan. This is THE reference for any kind of windowing on the
  1172. Mac, and it is excellent.
  1173.  
  1174. You can find it at ftp.apple.com.
  1175.  
  1176. Hope this helps.
  1177.  
  1178. Mark Hanrek
  1179.  
  1180. +++++++++++++++++++++++++++
  1181.  
  1182. >From jc@vivitech.com (John Cooper)
  1183. Date: Fri, 17 Jun 1994 20:13:42 GMT
  1184. Organization: Vivid Technologies Inc.
  1185.  
  1186.    I see a lot of people ask for code that implements floating windows. One
  1187. common suggestion is to use Yu's code from _develop_, but everyone knows
  1188. that that code is buggy. The follow-up suggestion is usually of the form:
  1189.  
  1190.    "The code in _develop_ still has bugs. Just go to an archive site and
  1191.     grab Infinity Windoid or ... "
  1192.  
  1193.    But is this all they really have to do? Just go get someone's WDEF, make
  1194. a NewWindow with it and, voila!, instant floating windows?
  1195.  
  1196.    Now please forgive my ignorance; I've never written a WDEF before. Could
  1197. someone explain to me how a WDEF alone achieves "floating" behavior in the
  1198. Macintosh environment? How can a WDEF itself control the BringToFront behavior
  1199. of all the other windows in an application (including doing the right thing
  1200. with dialog boxes)? Doesn't an application have to manage all the layering
  1201. itself even if a "windoid" WDEF is available? Doesn't the Infinity Windoid--
  1202. to use one example--only determine the windoid's appearance, and not it's
  1203. "floating" properties?
  1204.  
  1205.    Telling someone who is trying to get floating palettes working to go
  1206. get the Infinity Windoid is not enough, is it? Sure, that person will have
  1207. pretty windoids, but they won't float all by themselves, will they?
  1208.  
  1209. -John
  1210.  
  1211. +--------------------------+------------------------------------------+
  1212. | John R. Cooper           | Internet: jc@vivitech.com,               |
  1213. | Vivid Technologies, Inc. |           jcooper@world.std.com          |
  1214. | Waltham, MA 02154        | AOL:      JRCooper (jrcooper@aol.com)    |
  1215. +--------------------------+------------------------------------------+
  1216. | "God split himself into a myriad parts that he might have friends." |
  1217. | This may not be true, but it sounds good and is no sillier than any |
  1218. | other theology.                                                     |
  1219. |                        -- Long's Notes --                           |
  1220. +---------------------------------------------------------------------+
  1221.  
  1222. +++++++++++++++++++++++++++
  1223.  
  1224. >From tbrown@dorsai.org (Tommy Brown)
  1225. Date: Tue, 21 Jun 1994 20:46:07 GMT
  1226. Organization: The Dorsai Embassy, New York, NY
  1227.  
  1228. John Cooper (jc@vivitech.com) wrote:
  1229. :    I see a lot of people ask for code that implements floating windows. One
  1230. : common suggestion is to use Yu's code from _develop_, but everyone knows
  1231. : that that code is buggy. The follow-up suggestion is usually of the form:
  1232.  
  1233. :    "The code in _develop_ still has bugs. Just go to an archive site and
  1234. :     grab Infinity Windoid or ... "
  1235.  
  1236. :    But is this all they really have to do? Just go get someone's WDEF, make
  1237. : a NewWindow with it and, voila!, instant floating windows?
  1238.  
  1239. No. Although the code in develop has some bugs, as far as I know it is 
  1240. pretty much adequate. You will need to use the Infinity Windoid AND the 
  1241. code in develop to properly implement floating windows. The Infinity 
  1242. Windoid merely creates a window that looks like it should be floating. To 
  1243. make it actually float, you need to use modified code; the most recent 
  1244. code that I know of that will do the trick is what was found in develop.
  1245. -- 
  1246. Tommy Brown                 | Je suis tombe par terre, c'est la faute a
  1247. tbrown@dorsai.dorsai.org    | Voltaire. Le nez dans le ruisseau, c'est la
  1248. tommy6@aol.com              | faute a Rousseau. 
  1249. zipit@softlock.com          | - Gavroche
  1250.  
  1251. ---------------------------
  1252.  
  1253. >From damon@CS.ColoState.EDU (Yimmit)
  1254. Subject: _vSyncWait infinite loop?
  1255. Date: Thu, 16 Jun 1994 03:24:29 GMT
  1256. Organization: Imladris Occupants Inc.
  1257.  
  1258. OK.  So, I'm doing some communications with the serial ports, but every so often
  1259. I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1260. for an infinite loop to occur in _vSyncWait?  This happens just after I do an
  1261. FSWrite to the serial port.  Has anyone had this problem?  ANY help would be
  1262. appreciated since I can find no documentation on this - anywhere.
  1263.  
  1264. Tim Damon
  1265.  
  1266.  
  1267. +++++++++++++++++++++++++++
  1268.  
  1269. >From resnick@uiuc.edu (Pete Resnick)
  1270. Date: Wed, 15 Jun 1994 23:05:25 -0500
  1271. Organization: University of Illinois at Urbana-Champaign
  1272.  
  1273. In article <CrH04t.zH0@yuma.ACNS.ColoState.EDU>, damon@CS.ColoState.EDU
  1274. (Yimmit) wrote:
  1275.  
  1276. >OK.  So, I'm doing some communications with the serial ports, but every
  1277. >so often I get stuck in _vSyncWait forever.  My question is: Why?  What
  1278. >are the reasons for an infinite loop to occur in _vSyncWait?  This happens
  1279. >just after I do an FSWrite to the serial port.
  1280.  
  1281. The _vSyncWait loop is where synchronous calls wait for the interrupt
  1282. telling them that the I/O routine has completed. Since FSWrite is simply a
  1283. synchronous PBWrite, that's what's going on. Two causes are either (a) you
  1284. called a synchronous routine like FSWrite at interrupt time and the
  1285. interrupt for completion is never coming through or (b) the routine is
  1286. never completing, which means that the data is never getting to the serial
  1287. port (which would be very wierd). I vote for (a). :-)
  1288.  
  1289. pr
  1290. -- 
  1291. Pete Resnick        (...so what is a mojo, and why would one be rising?)
  1292. Doctoral Student - Philosophy Department, Gregory Hall, UIUC
  1293. System manager - Cognitive Science Group, Beckman Institute, UIUC
  1294. Internet: resnick@uiuc.edu
  1295.  
  1296. +++++++++++++++++++++++++++
  1297.  
  1298. >From absurd@apple.com (Tim Dierks)
  1299. Date: Thu, 16 Jun 1994 07:24:30 GMT
  1300. Organization: Apple Computer, Inc.
  1301.  
  1302. In article <CrH04t.zH0@yuma.ACNS.ColoState.EDU>, damon@CS.ColoState.EDU
  1303. (Yimmit) wrote:
  1304.  
  1305. > OK.  So, I'm doing some communications with the serial ports, but every so often
  1306. > I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1307. > for an infinite loop to occur in _vSyncWait?  This happens just after I do an
  1308. > FSWrite to the serial port.  Has anyone had this problem?  ANY help would be
  1309. > appreciated since I can find no documentation on this - anywhere.
  1310. > Tim Damon
  1311.  
  1312. It basically means your write isn't completing; you made a synchronous
  1313. write, so it won't return until all the bytes have been shoved through the
  1314. serial port.  When it can't shove all the characters through the serial
  1315. port, it waits until it can finish. Possibilities include:
  1316.  - Handshaking is on (hardware or software) and it's been told not to send.
  1317.  This is in particular a problem when writing code that runs on PowerBooks;
  1318. apparently, a desktop machine without its hardware handshaking line hooked
  1319. up will usually think it's OK to send, while a portable will usually think
  1320. that it's not OK to send; since hardware handshaking is on by default, this
  1321. can be a surprise the first time you run your program on a PowerBook with a
  1322. cable which doesn't have that pin hooked up.
  1323.  - You made a synchronous serial call from an interrupt level which doesn't
  1324. allow the serial port's interrupts to get through; in general, only make
  1325. asynchronous calls at interrupt time.
  1326.  - Something else is screwed up; however, the first two are most likely.
  1327.  
  1328. Best,
  1329.  - Tim
  1330.  
  1331. -- 
  1332. Tim Dierks
  1333. absurd@apple.com
  1334.  
  1335. +++++++++++++++++++++++++++
  1336.  
  1337. >From jvp@tools1.ee.iastate.edu (Jim Van Peursem)
  1338. Date: 16 Jun 94 16:26:56 GMT
  1339. Organization: Iowa State University, Ames, Iowa
  1340.  
  1341. In <resnick-1506942305250001@resnick1.isdn.uiuc.edu> resnick@uiuc.edu (Pete Resnick) writes:
  1342.  
  1343. >In article <CrH04t.zH0@yuma.ACNS.ColoState.EDU>, damon@CS.ColoState.EDU
  1344. >(Yimmit) wrote:
  1345.  
  1346. >>OK.  So, I'm doing some communications with the serial ports, but every
  1347. >>so often I get stuck in _vSyncWait forever.  My question is: Why?  What
  1348. >>are the reasons for an infinite loop to occur in _vSyncWait?  This happens
  1349. >>just after I do an FSWrite to the serial port.
  1350.  
  1351. >The _vSyncWait loop is where synchronous calls wait for the interrupt
  1352. >telling them that the I/O routine has completed. Since FSWrite is simply a
  1353. >synchronous PBWrite, that's what's going on. Two causes are either (a) you
  1354. >called a synchronous routine like FSWrite at interrupt time and the
  1355. >interrupt for completion is never coming through or (b) the routine is
  1356. >never completing, which means that the data is never getting to the serial
  1357. >port (which would be very wierd). I vote for (a). :-)
  1358.  
  1359.   Not wierd at all actually. The problem is most likely due to improper
  1360. initialization of serial handshaking options. Some machines default to
  1361. hardware handshaking, and their port defaults to the "wait" state when
  1362. no hardware handshaking lines are present. The fix is to call SerHShake()
  1363. or the preferred, Control(14?) to initialize the handshaking options.
  1364.  
  1365. +---------------------------------------------------------------+
  1366. | Jim Van Peursem - Ph.D. Candidate      (Ham Radio -> KE0PH)   |
  1367. | Department of Electrical Engineering and Computer Engineering |
  1368. | Iowa State University - Ames, IA 50011 : (515) 294-8339       |
  1369. | internet - jvp@iastate.edu  -or-  jvp@cpre1.ee.iastate.edu    |
  1370. +---------------------------------------------------------------+
  1371.  
  1372. +++++++++++++++++++++++++++
  1373.  
  1374. >From d88-jwa@mumrik.nada.kth.se (Jon Wdtte)
  1375. Date: 17 Jun 1994 20:55:20 GMT
  1376. Organization: The Royal Institute of Technology
  1377.  
  1378. In <CrH04t.zH0@yuma.ACNS.ColoState.EDU> damon@CS.ColoState.EDU (Yimmit) writes:
  1379.  
  1380. >OK.  So, I'm doing some communications with the serial ports, but every so often
  1381. >I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1382.  
  1383. _vSyncWait is where your Mac spends most of its time.
  1384. It takes a parameter block as parameter, and waits until
  1385. ioResult isn't 1 anymore. I/O is usually done through
  1386. spawning off an interrupt task which sets ioResult to
  1387. the result code.
  1388.  
  1389. There's probably something keeping your Mac from sending
  1390. the data, like an XOFF or no CTS or something. You can
  1391. avoid such hangs by always writing in async mode (but that
  1392. brings about other problems) with PBWriteAsync.
  1393.  
  1394. Cheers,
  1395.  
  1396.                     / h+
  1397. -- 
  1398.  -- Jon W{tte, h+@nada.kth.se, Mac Software Engineer Deluxe --
  1399.  
  1400.  "My boss made me say it. He dares you to sue!"
  1401.  
  1402. +++++++++++++++++++++++++++
  1403.  
  1404. >From damon@CS.ColoState.EDU (Yimmit)
  1405. Date: Sat, 18 Jun 1994 01:28:09 GMT
  1406. Organization: Imladris Occupants Inc.
  1407.  
  1408. Thanks to all who replied to this problem.  Silly me, I forgot to prototype my
  1409. send function for a separate source file.  Therefore, my command parameter was
  1410. being trashed in the send function and I was accidentally sending some huge
  1411. amount of data!!  Oh well.  Thanks again!
  1412. -->Tim Damon
  1413.  
  1414.  
  1415. +++++++++++++++++++++++++++
  1416.  
  1417. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  1418. Date: Sun, 19 Jun 1994 12:41:39 +1200 (NZST)
  1419. Organization: (none)
  1420.  
  1421. damon@CS.ColoState.EDU (Yimmit) writes:
  1422. > OK.  So, I'm doing some communications with the serial ports, but every so often
  1423. > I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1424. > for an infinite loop to occur in _vSyncWait?  This happens just after I do an
  1425. > FSWrite to the serial port.  Has anyone had this problem?  ANY help would be
  1426. > appreciated since I can find no documentation on this - anywhere.
  1427.  
  1428. Bet you're not calling SerHShake.
  1429.  
  1430. -- Bruce
  1431.  
  1432. ---------------------------
  1433.  
  1434. >From kelley@cs.dal.ca (Dan Kelley)
  1435. Subject: can toolbox draw text at an angle?
  1436. Date: Thu, 16 Jun 1994 13:04:12 GMT
  1437. Organization: Oceanography, Dalhousie University, Halifax, NS, Canada
  1438.  
  1439. Some years ago I did some Mac programming, and was disappointed to realize that
  1440. it could not easily draw text at an angle.
  1441.  
  1442. Is this still the case, or has system7/truefont/... made it possible to draw text
  1443. at an angle to the horizontal?
  1444.  
  1445. If you have information, I'd appreciate an email (since I presume, scanning the
  1446. group for the last few days, that others might not be interested).  Thanks.  Dan.
  1447.  
  1448.  
  1449. -- 
  1450. Dan Kelley                   | dan.kelley@dal.ca            (902)494-1694
  1451. Oceanography Department      |   ``We rise again,
  1452. Dalhousie University         |     in the faces of our children''
  1453. Halifax, NS, CANADA, B3H 4J1 |   The Rankin Family <North Country>
  1454.  
  1455. +++++++++++++++++++++++++++
  1456.  
  1457. >From andrewt@fluffy.cs.wisc.edu (Andrew Thomas-Cramer)
  1458. Date: 16 Jun 1994 16:39:46 GMT
  1459. Organization: University of WI, Madison -- Computer Sciences Dept.
  1460.  
  1461. kelley@cs.dal.ca (Dan Kelley) writes:
  1462.  
  1463. >Some years ago I did some Mac programming, and was disappointed to realize that
  1464. >it could not easily draw text at an angle.
  1465.  
  1466. >Is this still the case, or has system7/truefont/... made it possible to draw text
  1467. >at an angle to the horizontal?
  1468.  
  1469. >If you have information, I'd appreciate an email (since I presume, scanning the
  1470. >group for the last few days, that others might not be interested).  Thanks.  Dan.
  1471.  
  1472.     I'd be interested. Please post any responses.
  1473.     Clearly, it's possible -- composition and illustration software do it 
  1474. routinely. But how is it fastest done? A transformation of the bits generated
  1475. from Toolbox routines to a new rotation, or direct use of the font description?
  1476. Or has a Toolbox routine been added lately?
  1477.  
  1478.     andy thomas-cramer
  1479.  
  1480.  
  1481. +++++++++++++++++++++++++++
  1482.  
  1483. >From jwbaxter@olympus.net (John W. Baxter)
  1484. Date: Thu, 16 Jun 1994 15:00:05 -0700
  1485. Organization: Internet for the Olympic Peninsula
  1486.  
  1487. In article <CrHqz1.DIJ@cs.dal.ca>, kelley@cs.dal.ca (Dan Kelley) wrote:
  1488.  
  1489. > Some years ago I did some Mac programming, and was disappointed to realize that
  1490. > it could not easily draw text at an angle.
  1491. > Is this still the case, or has system7/truefont/... made it possible to draw text
  1492. > at an angle to the horizontal?
  1493.  
  1494. QuickDraw GX makes rotated text (or rotated anything, almost) trivial. 
  1495. Summer.
  1496.  
  1497. -- 
  1498. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1499.    No hablo Intel.
  1500.    jwbaxter@pt.olympus.net
  1501.  
  1502. +++++++++++++++++++++++++++
  1503.  
  1504. >From gabe@shiva.com (Gabriel Lawrence)
  1505. Date: Thu, 16 Jun 94 21:59:02 GMT
  1506. Organization: Shiva Corporation
  1507.  
  1508. In Article <2tpv8i$4rn@spool.cs.wisc.edu>, andrewt@fluffy.cs.wisc.edu
  1509. (Andrew Thomas-Cramer) wrote:
  1510. >kelley@cs.dal.ca (Dan Kelley) writes:
  1511. >
  1512. >>Some years ago I did some Mac programming, and was disappointed to realize
  1513. >>that it could not easily draw text at an angle.
  1514. >>
  1515. >>Is this still the case, or has system7/truefont/... made it possible to draw
  1516. >>text at an angle to the horizontal?
  1517.  
  1518. Regular old QuickDraw never supported it but Adobe Type Manager did.  I
  1519. asked Apple a few years ago how to do it without ATM and was told that if I
  1520. used the same approach that ATM offered, they would produce a compatible
  1521. method.  They've finally offered a solution (though not really compatible)
  1522. in the form of QuickDraw GX.  The following is excerpted from "IM-QuickDraw
  1523. GX Typography"
  1524.  
  1525. "GXRotateShape:
  1526. Rotates the typographic shape. This function can affect the mapping of the
  1527. typographic shape's transform if the gxMapTransformShape attribute is set.
  1528. Otherwise, it converts a text shape to a glyph shape, and it changes the
  1529. values in the glyph shape's tangents array. You use the GXRotateShape
  1530. function to create vertical text. See the chapter "Typographic Styles" for
  1531. more information on vertical text."
  1532.  
  1533. You can also directly alter the glyph tangent array if you want to do
  1534. something like draw text along an arbitrary line.  In short, now you can
  1535. easily do amazing things to text including rotation, skews, and generic
  1536. transforms.
  1537.  
  1538. =Gabe=
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545. >        I'd be interested. Please post any responses.
  1546. >        Clearly, it's possible -- composition and illustration software do it 
  1547. >routinely. But how is it fastest done? A transformation of the bits generated
  1548. >from Toolbox routines to a new rotation, or direct use of the font description?
  1549. >Or has a Toolbox routine been added lately?
  1550. >
  1551. >        andy thomas-cramer
  1552. >
  1553.  
  1554. - ----------------------
  1555. Gabriel Lawrence                                               Shiva Corporation
  1556. Software Tool               "All Disclaimers Apply"             gabe@shiva.com  
  1557.  
  1558. +++++++++++++++++++++++++++
  1559.  
  1560. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  1561. Date: Thu, 16 Jun 1994 23:05:05 GMT
  1562. Organization: Apple Computer
  1563.  
  1564. In article <2tpv8i$4rn@spool.cs.wisc.edu> Andrew Thomas-Cramer,
  1565. andrewt@fluffy.cs.wisc.edu writes:
  1566. >     Clearly, it's possible -- composition and illustration software do it 
  1567. > routinely. But how is it fastest done? A transformation of the bits
  1568. generated
  1569. > from Toolbox routines to a new rotation, or direct use of the font
  1570. description?
  1571.  
  1572. I'd guess that most programs currently draw offscreen and transform the
  1573. bitmap. For details on bitmap transmogrification, see "Graphics Gems 3" from
  1574. Academic Press.
  1575.  
  1576. > Or has a Toolbox routine been added lately?
  1577.  
  1578. Why yes -- QuickDraw GX supports arbitrary transformations of text, including
  1579. skew and perspective in addition to rotation. Anything you can describe in a
  1580. 3x3 matrix. Not only that, but you can allow the user to edit the transformed
  1581. text (typing into perspective text is pretty trippy.) You can also fit text
  1582. to a curve, but it's not directly editable after that.
  1583.  
  1584. --Jens Alfke
  1585.   jens_alfke@powertalk              Rebel girl, rebel girl,
  1586.             .apple.com              Rebel girl you are the queen of my world
  1587.  
  1588. +++++++++++++++++++++++++++
  1589.  
  1590. >From Mark Hanrek <hanrek@cts.com>
  1591. Date: Fri, 17 Jun 1994 05:02:28 GMT
  1592. Organization: The Information Workshop
  1593.  
  1594. In article <jwbaxter-160694150005@ptpm010.olympus.net> John W. Baxter,
  1595. jwbaxter@olympus.net writes:
  1596.  
  1597. > QuickDraw GX makes rotated text (or rotated anything, almost) trivial. 
  1598.  
  1599.  
  1600. I heard a rumor that QuickTime 2.0 was going to have the stuff that
  1601. allows still pictures to be quickly rotated.
  1602.  
  1603. Then again, it does make sense for this kinda stuff to be in QuickDraw/GX.
  1604.  
  1605. Anyone know the skinny on this?
  1606.  
  1607. In particular, I am interested in rotating pixmaps an arbitrary number of
  1608. degrees, kinda thing.
  1609.  
  1610. Thanks.
  1611.  
  1612. Mark Hanrek
  1613.  
  1614. +++++++++++++++++++++++++++
  1615.  
  1616. >From jwbaxter@olympus.net (John W. Baxter)
  1617. Date: Fri, 17 Jun 1994 09:10:47 -0700
  1618. Organization: Internet for the Olympic Peninsula
  1619.  
  1620. In article <CrIzC4.9K0@crash.cts.com>, Mark Hanrek <hanrek@cts.com> wrote:
  1621.  
  1622. > In article <jwbaxter-160694150005@ptpm010.olympus.net> John W. Baxter,
  1623. > jwbaxter@olympus.net writes:
  1624. > > QuickDraw GX makes rotated text (or rotated anything, almost) trivial. 
  1625. ...
  1626. > In particular, I am interested in rotating pixmaps an arbitrary number of
  1627. > degrees, kinda thing.
  1628.  
  1629. QD GX does that, in two fundamentally different ways: (a) by shuffling the
  1630. pixels around in the actual bitmap geometry, or (b) by applying a rotation
  1631. transform during drawing.  (a) is often very bad, particularly if you are
  1632. going to rotate several times.  There's an example of the result of that in
  1633. the color plates at the front of Inside Mac:  QD GX Graphics.  [It starts
  1634. as a nice color ramp...it finishes as a Rorschach inkblot.]
  1635.  
  1636. -- 
  1637. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1638.    No hablo Intel.
  1639.    jwbaxter@pt.olympus.net
  1640.  
  1641. +++++++++++++++++++++++++++
  1642.  
  1643. >From johnb@tempest.net.hk (John W. Blackburne)
  1644. Date: 18 Jun 1994 03:50:03 GMT
  1645. Organization: Tempest, Hong Kong
  1646.  
  1647. Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  1648.  
  1649. > Why yes -- QuickDraw GX supports arbitrary transformations of text,
  1650. including
  1651. > skew and perspective in addition to rotation. Anything you can describe in
  1652. a
  1653. > 3x3 matrix. Not only that, but you can allow the user to edit the
  1654. transformed
  1655. > text (typing into perspective text is pretty trippy.) You can also fit text
  1656. > to a curve, but it's not directly editable after that.
  1657.  
  1658. Can someone please explain to me how this works. If you are using a 3 x 3
  1659. matrix (on an anything x anything matrix) for transformations you get
  1660. linear transformations, which include scaling, rotating, reflecting and
  1661. skewing but NOT transforming the perspective of a shape, at least not when
  1662. operating on the real two-dimensional space QD GX works in.
  1663.  
  1664. John
  1665.  
  1666.                   Tempest, a FirstClass BBS, Hong Kong 802-7395
  1667.                               John W. Blackburne, administrator
  1668. - - When You're cruisin' in overdrive,
  1669.        Don' have to listen to no, run o' the mill talk jive ---
  1670.  
  1671. +++++++++++++++++++++++++++
  1672.  
  1673. >From Cary Clark <crclark@apple.com>
  1674. Date: Sun, 19 Jun 1994 22:04:31 GMT
  1675. Organization: Apple Computer, Inc.
  1676.  
  1677. In article <3624861694.8241498@tempest.tempest.net.hk> John W.
  1678. Blackburne, >>Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  1679. >> Why yes -- QuickDraw GX supports arbitrary transformations of text, 
  1680. >> including skew and perspective in addition to rotation. Anything you
  1681. >> can describe in a 3x3 matrix. Not only that, but you can allow the user
  1682. >> to edit the transformed text (typing into perspective text is pretty
  1683. >>  trippy.)
  1684.  
  1685. johnb@tempest.net.hk writes:
  1686. >Can someone please explain to me how this works. If you are using a 3 x 3
  1687. >matrix (on an anything x anything matrix) for transformations you get
  1688. >linear transformations, which include scaling, rotating, reflecting and
  1689. >skewing but NOT transforming the perspective of a shape, at least not
  1690. >when operating on the real two-dimensional space QD GX works in.
  1691.  
  1692. QuickDraw GX expresses all of its coordinates by the vector (x, y, 1).
  1693. Multiplying this by the 3x3 results in (x', y', z'). Viewing this back in
  1694. the destination space requires that z = 1, so this vector is normalized
  1695. as (x'/z', y'/z', 1). The extra divisions required by perspective
  1696. calculations are performed only when necessary, so that non-perspective
  1697. drawing isn't penalized.
  1698.  
  1699. Cary Clark
  1700. Apple Computer, Inc.
  1701.  
  1702. +++++++++++++++++++++++++++
  1703.  
  1704. >From kelley@cs.dal.ca (Dan Kelley)
  1705. Date: Mon, 20 Jun 1994 12:40:28 GMT
  1706. Organization: Oceanography, Dalhousie University, Halifax, NS, Canada
  1707.  
  1708. The answers to my question about rotated text have all mentioned GX.  I'm new
  1709. to the mac, and have 2 questions:
  1710.  
  1711. 1) is quickdraw gx available on all shipping platforms, or is it something new?
  1712.  
  1713. 2) is there a downloadable document on gx, or a book title I can look up?
  1714.  
  1715. Thanks very much to everyone who has been so helpful.
  1716. -- 
  1717. Dan Kelley                   | dan.kelley@dal.ca            (902)494-1694
  1718. Oceanography Department      |   ``We rise again,
  1719. Dalhousie University         |     in the faces of our children''
  1720. Halifax, NS, CANADA, B3H 4J1 |   The Rankin Family <North Country>
  1721.  
  1722. +++++++++++++++++++++++++++
  1723.  
  1724. >From jwbaxter@olympus.net (John W. Baxter)
  1725. Date: Mon, 20 Jun 1994 07:50:02 -0700
  1726. Organization: Internet for the Olympic Peninsula
  1727.  
  1728. In article <Crp4JI.JJK@cs.dal.ca>, kelley@cs.dal.ca (Dan Kelley) wrote:
  1729.  
  1730. > The answers to my question about rotated text have all mentioned GX.  I'm new
  1731. > to the mac, and have 2 questions:
  1732. > 1) is quickdraw gx available on all shipping platforms, or is it something new?
  1733.  
  1734. QuickDraw GX is just emerging into the post-beta world.  It is available
  1735. for license to distribute with applications which use it, and will be
  1736. shipped with System 7.5 (real soon now).
  1737.  
  1738. > 2) is there a downloadable document on gx, or a book title I can look up?
  1739. There is more than "a book".  There are 7 new volumes of Inside Macintosh,
  1740. 3 of which (at least) have hit the stores in paper form.  They are
  1741. available (except for the Overview document so far) on various Apple CD
  1742. ROMs.  Issue 18 of "develop" ($10 as a back issue...double check that the
  1743. back issue includes the same-numbered CD) is one source.  "develop" is
  1744. worth subscribing too regardless of the CD, IMHO.
  1745.  
  1746. It's been more years than it should have been since I have been in Halifax
  1747. (via cruise ship).
  1748. -- 
  1749. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1750.    No hablo Intel.
  1751.    jwbaxter@pt.olympus.net
  1752.  
  1753. +++++++++++++++++++++++++++
  1754.  
  1755. >From bhorling@mail.trincoll.edu (Bryan Horling)
  1756. Date: Sun, 19 Jun 1994 20:55:49 -0500
  1757. Organization: Trinity College
  1758.  
  1759. In article <1994Jun19.220431.20334@gallant.apple.com>, Cary Clark
  1760. <crclark@apple.com> wrote:
  1761.  
  1762. > In article <3624861694.8241498@tempest.tempest.net.hk> John W.
  1763. > Blackburne, >>Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  1764. > >> Why yes -- QuickDraw GX supports arbitrary transformations of text, 
  1765. > >> including skew and perspective in addition to rotation. Anything you
  1766. > >> can describe in a 3x3 matrix. Not only that, but you can allow the user
  1767. > >> to edit the transformed text (typing into perspective text is pretty
  1768. > >>  trippy.)
  1769. > johnb@tempest.net.hk writes:
  1770. > >Can someone please explain to me how this works. If you are using a 3 x 3
  1771. > >matrix (on an anything x anything matrix) for transformations you get
  1772. > >linear transformations, which include scaling, rotating, reflecting and
  1773. > >skewing but NOT transforming the perspective of a shape, at least not
  1774. > >when operating on the real two-dimensional space QD GX works in.
  1775. > QuickDraw GX expresses all of its coordinates by the vector (x, y, 1).
  1776. > Multiplying this by the 3x3 results in (x', y', z'). Viewing this back in
  1777. > the destination space requires that z = 1, so this vector is normalized
  1778. > as (x'/z', y'/z', 1). The extra divisions required by perspective
  1779. > calculations are performed only when necessary, so that non-perspective
  1780. > drawing isn't penalized.
  1781. > Cary Clark
  1782. > Apple Computer, Inc.
  1783.  
  1784. Is there any easy way to do rotations without QuickDraw GX?  Say you wanted
  1785. to write in the y axis label on a graph or somthing like that (so that the
  1786. the bottom of the text was parallel with the axis), how could you go about
  1787. doing it?
  1788.  
  1789. -- 
  1790.  Bryan C.Horling       ||||     
  1791.  Trinity College        @@      bhorling@mail.cc.trincoll.edu  
  1792.   Hartford, CT          == 
  1793.  
  1794. +++++++++++++++++++++++++++
  1795.  
  1796. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  1797. Date: Mon, 20 Jun 1994 20:58:11 GMT
  1798. Organization: Apple Computer
  1799.  
  1800. John W. Blackburne, johnb@tempest.net.hk writes:
  1801. > Can someone please explain to me how this works. If you are using a 3 x 3
  1802. > matrix (on an anything x anything matrix) for transformations you get
  1803. > linear transformations, which include scaling, rotating, reflecting and
  1804. > skewing but NOT transforming the perspective of a shape, at least not when
  1805. > operating on the real two-dimensional space QD GX works in.
  1806.  
  1807. 3x3 matrices, if you set the top-right and middle-right elements to be
  1808. nonzero, WILL produce perspective transforms that make it appear as though
  1809. the two-dimensional drawing plane has been rotated in 3space and projected
  1810. back onto the screen. You obviously can't draw stuff in real 3d this way,
  1811. since your input is only 2d points, but for mapping your drawing onto an
  1812. arbitrarily oriented surface in 3space it's ideal. Check out some of the
  1813. demos at the end of the SlideMaster GX demo -- there's one that does a flyby
  1814. of some 3d text, and another with a 3d rotating die. (I think for the die
  1815. they had to use a different transformation for each face.)
  1816.  
  1817. --Jens Alfke
  1818.   jens_alfke@powertalk              Rebel girl, rebel girl,
  1819.             .apple.com              Rebel girl you are the queen of my world
  1820.  
  1821. ---------------------------
  1822.  
  1823. End of C.S.M.P. Digest
  1824. **********************
  1825.  
  1826.  
  1827. ˇ